package com.xiaodu.acer.phoneplay.common.util;

import android.content.Context;

import com.xiaodu.acer.phoneplay.bean.AppInfo;
import com.xiaodu.acer.phoneplay.bean.downloadbean.DownloadMission;

/**
 * @author 小杜
 *         邮箱:m15701207383@163.com
 * @version V1.0
 * @Description: ${TODO}(用一句话描述该文件做什么)
 * @date 2018/1/23 14:41
 */

public class AppStoreUtil {


    public static DownloadMission appInfoToMission(AppInfo appInfo, Context context) {

        String url = "NONE";
        if (appInfo.getAppDownloadInfo() != null) {
            url = appInfo.getAppDownloadInfo().getDownloadUrl();
        }

        DownloadMission mission = new DownloadMission(url);
        mission.setId(appInfo.getId());
        mission.setTag(appInfo.getDisplayName());
        mission.setSaveName(appInfo.getReleaseKeyHash() + ".apk");
        mission.setDisplayName(appInfo.getDisplayName());
        mission.setPackageName(appInfo.getPackageName());
        mission.setVersionName(appInfo.getVersionName());
        mission.setIcon(appInfo.getIcon());

        return mission;
    }



}
